
<?php
extract($this->user);
$urlBack = $this->url(array('controller' => 'user', 'action' => 'edit', 'id' => $id_user));
switch ($role) {
    case 'guest':$role = 'Invité';
        break;
    case 'user':$role = 'Utilisateur';
        break;
    case 'admin':$role = 'Administrateur';
        break;
    case 'super':$role = 'Super Administrateur';
        break;
    default:$role = $role;
}
?>
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
<section style="padding:0px;">
    <div class="page-header">
        <h3><?php echo ucfirst($titre) . " " . $prenom . " " . $nom; ?> <small><?php echo $nom_cabinet; ?></small></h3>
    </div>
    <div class="row">
        <div class="span-one-third">
            <h4>Adresse</h4>
            <ul class="unstyled">
                <li><?php echo $adresse; ?></li>
                <li><?php echo $adresse_2; ?></li>
                <li><?php echo $cpostal . " " . $ville; ?></li>
            </ul>

        </div>
        <div class="span-one-third" style="border:1px solid lightgrey;">
            <div id="map_canvas" style="width:320px; height:240px"></div>
        </div>

        <div class="span-one-third">
            <h4>Contact</h4>
            <ul class="unstyled">
                <li><strong>Téléphone</strong> : <?php echo $tel; ?></li>
                <li><strong>Portable</strong> : <?php echo $portable; ?></li>
                <li><strong>eMail</strong> : <?php echo "<a href='mailto:" . $email . "'>" . $email . "</a>"; ?></li>
            </ul>
        </div>

        <div class="span-one-third">
            <h4>Accés du compte</h4>
            <ul class="unstyled">
                <li><strong>Nom d'utilisateur</strong> : <?php echo $login; ?></li>
                <li><strong>Rôle</strong> : <?php echo ucfirst($role); ?></li>
            </ul>
        </div>
    </div>


    <div class="actions" style="padding: 17px 0 0;">
        <button class="btn primary" 
                onclick="document.location='<?php echo $urlBack; ?>';" >Modifier</button>
    </div>
</section>
<script type="text/javascript">

    //ROADMAP displays the normal, default 2D tiles of Google Maps.
    //SATELLITE displays photographic tiles.
    //HYBRID displays a mix of photographic tiles and a tile layer for prominent features (roads, city names).
    //TERRAIN displays physical relief tiles for displaying elevation and water features (mountains, rivers, etc.).

    var geocoder;
    var map;

    function initialize() {
        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(<?php echo $Pa; ?>, <?php echo $Qa; ?>) ;//45.631506, 5.896236);
        var myOptions = {
            zoom: 16,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var canvas = $("#map_canvas").get(0);
        map = new google.maps.Map( canvas, myOptions);
        //codeAddress();
    }


    function codeAddress() {
        var address = "18 rue jule pams, 66250, FR";
        geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });
                $('#map_canvas a').remove();
            } else {
                alert("Geocode was not successful for the following reason: " + status);
            }
        });
    }

    $(document).ready(initialize);

</script>
